﻿// JScript 文件
//是否为IE
var isIE = (document.all && window.ActiveXObject && !window.opera) ? true : false;
var isOpera =
//获取事件,只能用于无参数的函数
function GetEvent() {
    srcE = window.event ? window.event : GetEvent.caller.arguments[0];
    return srcE;
}

function GetKeyCode(e) {
    document.getElementsByTagName
    var kcode;
    if (window.event) { kcode = window.event.keyCode; } //键盘代码接受
    else if (e.which) { kcode = e.which; }
    return kcode;
}
//设置键盘代码
function SetKeyCode(e, kcode) {

    if (window.event) { window.event.keyCode = kcode; }
    else if (e.which) { e.which = kcode; }
}

//获取事件的对象
//e为事件
function GetEventElement(e) {
    var srcElement = e.srcElement;
    if (!srcElement) {
        srcElement = e.target;
    }
    return srcElement;
}
//设置事件属性
//obj对象,action动作,fun要执行的函数
function SetEvent(obj, action, fun) {
    if (!obj) {
        throw new Error("SetEvent参数错误:没有事件依赖的对象!");
        return;
    }
    if (typeof (action) != 'string') {
        throw new Error("action参数错误:没有具体的事件名称!");
        return;
    }
    if (typeof (fun) != 'function') {
        throw new Error("fun参数错误:没有指定事件对应的具体操作函数!");
        return;
    }
    if (obj.attachEvent) {//IE
        obj.attachEvent("on" + action, fun);
    }
    else {
        obj.addEventListener(action, fun, false);
    }
}
//取消事件
//obj对象,action动作,fun要执行的函数
function ClearEvent(obj, action, fun) {
    if (!obj) {
        throw new Error("SetEvent参数错误:没有事件依赖的对象!");
        return;
    }
    if (typeof (action) != 'string') {
        throw new Error("action参数错误:没有具体的事件名称!");
        return;
    }
    if (typeof (fun) != 'function') {
        throw new Error("fun参数错误:没有指定事件对应的具体操作函数!");
        return;
    }
    if (obj.attachEvent) {
        //IE
        obj.detachEvent("on" + action, fun);
    }
    else {
        obj.removeEventListener(action, fun, false);
    }
}
//退出事件
function EventAbort(e) {
    if (e.preventDefault) return e.preventDefault();
    else return e.returnValue = false;
} // shawl.qiu script 
//获取指定ID的标签
function get$(id) {
    return document.getElementById(id);
}
//获取指定名字的标签集
function get$N(name) {
    return document.getElementsByName(name);
}
//获取指定标签名字的标签集合
function get$T(name) {
    return document.getElementsByTagName(name);
}
//获取对象在网页中的位置Top
function GetTop(obj) {
    var top = obj.offsetTop;
    if (obj.offsetParent.tagName != "BODY") {
        top += GetTop(obj.offsetParent);
    }
    else {
        top += obj.offsetParent.offsetTop;
    }
    return top;
}
//获取对象在网页中的位置left
function GetLeft(obj) {
    var top = obj.offsetLeft;
    if (obj.offsetParent.tagName != "BODY") {
        top += GetLeft(obj.offsetParent);
    }
    else {
        top += obj.offsetParent.offsetLeft;
    }
    return top;
}
/*改变链接颜色*/
function changecolor(obj) {
    var alink = document.getElementsByTagName("A");
    for (i = 0; i < alink.length; i++) {
        alink[i].className = 'leftlink';
    }
    obj.className = "leftlink_on";
}
/*显示确认框,并执行带参函数fun*/
function Confirm(fun, msg) {
    var myDialogResult = window.confirm(msg);
    if (myDialogResult == true) {
        eval(fun);
        return true;
    }
    else {
        return false;
    }
}
/*删除*/
function Del(fun) {
    var msg = eval(fun);
    if (msg == "")//返回空,删除成功
        msg = "删除成功";
    //list.innerHTML=HKSManage_Manager_User_Org_Del_Order.Dell('11').value;
    alert(msg);
}
/*重新载入列表数据*/
function ReloadList(fun) {
    var list = get$("ctl00_ContentPlaceHolder1_organList");
    list.innerHTML = eval(fun);
}
/*重新载入分页数据*/
function ReloadPagination(fun) {
    var pagination = get$("ctl00_ContentPlaceHolder1_organPagination");
    pagination.innerHTML = eval(fun);
}
/*重新载入带模板数据*/
function ReloadTemplateData(divID, fun) {
    var div = get$("ctl00_ContentPlaceHolder1_" + divID + "");
    div.innerHTML = eval(fun);
}
/*重新载入数据*/
function ReloadData(divID, fun) {
    var div = get$(divID);
    div.innerHTML = eval(fun);
}
function Execute(fun) {
    eval(fun);
}
function Sort(fun) {
    eval(fun);
}
function ResetPassword(fun) {
    var msg = eval(fun);
    if (msg == "")//
        msg = "重置密码成功";
    //list.innerHTML=HKSManage_Manager_User_Org_Del_Order.Dell('11').value;
    alert(msg);
}
//按enter执行指定的动作按钮
function InputValidEnter(e, btnId) {
    var kcode;
    kcode = GetKeyCode(e);
    if (kcode == 13) {
        get$(btnId).click();
        if (e.preventDefault) e.preventDefault();
        else { event.returnValue = false };
    }

}
//验证键盘输入是否有效数字,按enter执行按钮动作
function InputValid(e, btnId) {
    var kcode;
    if (window.event) { kcode = e.keyCode; }
    else if (e.which) { kcode = e.which; }
    var validKey = (kcode == 8 || kcode == 46 || kcode == 39 || (kcode >= 48 && kcode <= 57) || (kcode >= 96 && kcode <= 105));
    if (!validKey) {
        if (kcode == 13) document.getElementById(btnId).click();
        if (e.preventDefault) e.preventDefault();
        else { event.returnValue = false };
    }
}
//投资组合,验证%比
function InputValidPercent(e) {
    var kcode;
    var text;
    kcode = GetKeyCode(e);
    text = GetEventElement(e);

    if (GetPercent() > 100) {
        text.className = "forms_disable";
        alert("提示:您输入的百分比合计大于100%");
    }
    else {
        for (i = 1; i <= 10; i++) {
            var txt = get$("ctl00_ContentPlaceHolder1_txtPercent" + i);
            txt.className = "forms";
        }
    }
}
//获取投资组合百分比
function GetPercent() {
    var per = parseFloat("0");
    for (i = 1; i <= 10; i++) {
        var txt = get$("ctl00_ContentPlaceHolder1_txtPercent" + i);
        var txtValue = txt.value;
        var value;
        if (txtValue == "" || isNaN(txtValue))
        { value = 0; }
        else
        { value = parseFloat(txtValue); }
        per += value;
    }
    return per;

}
//验证键盘输入的是否为浮点型数字
function InputValidFloat(e) {
    var kcode;
    if (window.event) { kcode = e.keyCode; }
    else if (e.which) { kcode = e.which; }
    var validKey = (kcode == 8 || kcode == 13 || kcode == 46 || kcode == 37 || kcode == 39 || (kcode >= 48 && kcode <= 57) || (kcode >= 96 && kcode <= 105) || kcode == 110 || kcode == 190);
    if (!validKey) {
        if (e.preventDefault) e.preventDefault();
        else { event.returnValue = false };
    }
}

//粘贴认证
function PasteValidLength(e, length) {
    var kcode;
    var text;
    var validText = "";
    kcode = GetKeyCode(e);
    text = GetEventElement(e);
    validText = text.value;
    var clipboard = clipboardData.getData("Text");
    if (clipboard != null) {
        validText += clipboard;
    }
    if (validText.length > length) {
        text.className = "forms_disable";
        text.title = "您最多能输入" + length + "个字";
        if (!(kcode == 8 || kcode == 13 || kcode == 46 || (kcode >= 16 && kcode <= 18) || (kcode >= 33 && kcode <= 40)))
        { alert("您最多能输入" + length + "个字\n但是经过您现刚才的copy,现在已经是" + validText.length + "个字\n请清除多余的文字") };
        SetEvent(text, "keydown", InputValidOnlyBack);

    }
    else
    { text.className = "forms"; }
}

//验证输入框文字的长度,若指定按钮,并执行按钮的操作
function InputValidLength(e, length, btnID) {
    var kcode;
    var text;
    kcode = GetKeyCode(e);
    text = GetEventElement(e);
    if (text.value.length > length) {
        text.className = "forms_disable";
        text.title = "您最多能输入" + length + "个字";
        if (!(kcode == 8 || kcode == 13 || kcode == 46 || (kcode >= 16 && kcode <= 18) || (kcode >= 33 && kcode <= 40)))
        { alert("您最多能输入" + length + "个字\n您现在已经输入了" + text.value.length + "个字\n请清除多余的文字") };
        SetEvent(text, "keydown", InputValidOnlyBack);
        SetEvent(text, "keypress", InputValidOnlyBack); //opera
    }
    else
    { text.className = "forms"; }
    if (!(btnID == undefined || btnID == null)) {
        DoKeyUpCtrlEnter(e, btnID)
    }
}
//只接受控制键
function InputValidOnlyBack(e) {
    var kcode;
    kcode = GetKeyCode(e);
    text = GetEventElement(e); //事件按钮接受
    if (!(kcode == 8 || kcode == 13 || kcode == 46 || (kcode >= 16 && kcode <= 18) || (kcode >= 33 && kcode <= 40)))//若不是允许键值,取消键盘事件
    {
        if (e.preventDefault)
        { e.preventDefault(); }
        else
        { e.returnValue = false; }
    }
    else//若是允许键值,取消onkeydown函数
    {
        ClearEvent(text, "keydown", InputValidOnlyBack);
        ClearEvent(text, "keypress", InputValidOnlyBack);
    }


}
//ctrl+enter提交
function DoKeyUpCtrlEnter(e, btnId) {
    var kcode;
    kcode = GetKeyCode(e);
    if (e.ctrlKey && kcode == 13)
    { document.getElementById(btnId).click(); }
    if (e.preventDefault) e.preventDefault();
    else { event.returnValue = false };
}

//加载某页
function GoToPagination(url) { location.href = url; }
//获取指定名字的选中的checkbox值
function GetChkChecked(name) {
    var chks = get$N(name);
    var i;
    var validate = "";
    for (i = 0; i < chks.length; i++) {
        if (chks[i].checked == true) {
            validate += chks[i].value + ",";
        }
    }
    return validate.substring(0, validate.length - 1);
}
//设置指定名字的checkbox的checked属性
function SetChkChecked(name, b) {
    var chks = get$N(name);
    var i;
    var validate = "";
    for (i = 0; i < chks.length; i++) {
        chks[i].checked = b;
    }
}
//清除文本框的默认值
function ClearDefaultValue(e, defaultValue) {
    var obj = GetEventElement(e);
    if (obj.value == defaultValue) {
        obj.value = "";
    }
}
/*遮罩层*/
function showMask() {
    SetDisabled("select", true);
    var mask = getElementInBody("popUpMask", "", "", "", "", "position:absolute;left:0px;top:0px;width:" + document.body.scrollWidth + "px;height:" + document.body.scrollHeight + "%;z-index:1000;background:#000;opacity:0.3;filter:Alpha(enabled=true,opacity=30)");
    mask.style.display = "";
    try { hideToolBar(); }
    catch (e) { }
}
function hideMask() {
    SetDisabled("select", false);
    var mask = get$("popUpMask");
    if (!!mask)
        mask.style.display = "none";
    try { showToolBar(); }
    catch (e) { }
}
function getElementInBody(id, tagName, insertFirst, parentNodeID, className, initCSSText) {
    var e = get$(id);
    if (!e) {
        tagName = (!tagName) ? "div" : tagName;
        e = document.createElement(tagName); e.id = id;
        var parentNode = (!parentNodeID) ? document.body : $(parentNodeID)
        if (insertFirst)
            parentNode.insertBefore(e, parentNode.firstChild);
        else
            parentNode.appendChild(e);
        e.className = className ? className : "";
        e.style.cssText = initCSSText ? initCSSText : "";
    }
    parentNode = null;
    return e;
}
//设置同一种标签的disabled属性
function SetDisabled(tagName, flag) {
    var tags = get$T(tagName);
    var ifrs = get$T("iframe");
    var isDisabled = "disabled";
    var zIndex = "auto";
    if (flag == false)
    { isDisabled = ""; zIndex = "1" }
    for (i = 0; i < tags.length; i++) {
        tags[i].disabled = isDisabled;
        tags[i].zIndex = zIndex;

    }
    for (i = 0; i < ifrs.length; i++)//设置iframe
    {
        SetDisabledI(ifrs[i], tagName, isDisabled, zIndex);
    }

}
function SetDisabledI(obj, tagName, flag, zIndex)//设置所有iframe
{
    var i;
    var j;
    var ifrs = obj.contentWindow.document.getElementsByTagName("iframe"); //iframe中是否还有ifraeme
    tags = obj.contentWindow.document.getElementsByTagName(tagName); //获取iframe中的tags
    for (j = 0; j < tags.length; j++) {
        tags[j].disabled = flag;
        tags[j].zIndex = zIndex;
    }
    for (i = 0; i < ifrs.length; i++) {
        SetDisabledI(ifrs[i], tagName, flag);
    }
}
/*遮罩层 end*/

/*enter 转化成tab*/
// 用途：enter 转化成tab
//使用：onload ="initEnter2Tab()" form标记加上 <form name="frm" type="enter2tab">...</form>

var isCycle = false; //当光标到最后一个元素的时候，是否循环光标焦点，
var iCurrent = -1;
var frmName = "0"//input_form
//
function enterToTab(eventE)  //网页里按回车时焦点的转移
{

    var kcode = GetKeyCode(eventE);
    var e = GetEventElement(eventE);
    if (e == null) return false;
    //获得当前表单的名字
    for (i = 0; i < document.forms.length; i++) {
        for (var el in document.forms[i].elements) {
            if (e.id == el.id) {
                frmName = document.forms[i].name
            }
        }
    }

    //if(kcode == 13&& (!e.getAttribute("customDefaultEvent")=="false"||e.getAttribute("customDefaultEvent")==null))//取消事件
    if (kcode == 13)//取消事件
    {

        switch (e.tagName)//标签类型
        {
            case "INPUT":
                handleInput(e)
                break;
            case "SELECT":
                handleSelect(e)
                break;
            case "TEXTAREA":
                return;
                break;
            default:
                //window.status = "未知的标签名称:"+e.tagName+"，不能移动焦点！"
        }
        if (eventE.preventDefault) eventE.preventDefault();
        else { eventE.returnValue = false };

    } // end if


}
//处理input 标签类型
function handleInput(e) {
    switch (e.type) {
        case "text":
        case "password":
        case "checkbox":
        case "radio":
        case "file":
            moveFocusToNextElement(e)
            break;
        case "submit": //处理有提交按钮的情况
        case "button":
            if (isHandleSubmit(e)) {
                handleSubmit(e)
                focusOnNextElement(document.forms[frmName].elements, iCurrent - 1)
                break;
            }
            moveFocusToNextElement(e)
            break;
        default:
    }
}
//处理select 标签类型
function handleSelect(e) {
    moveFocusToNextElement(e)
}
//处理textarea 标签类型
function handleTextarea(e) {
    moveFocusToNextElement(e)
}
//移动到下一个元素
function moveFocusToNextElement(e) {
    var oE = document.forms[frmName].elements, iCurentPos = -1;
    for (var i = 0; i < oE.length; i++) {
        if (oE[i] == e) iCurentPos = i;
        if (iCurentPos > -1 && iCurentPos + 1 < oE.length) {
            //把焦点设置到下一个可用的元素上
            focusOnNextElement(oE, iCurentPos)
        }
    }
}
//下一个可用元素得到焦点 n 元素的位置
function focusOnNextElement(oElements, iIndex) {
    var oE = oElements
    var oldIndex = iIndex
    while (oE[iIndex + 1].type == "hidden" || oE[iIndex + 1].disabled || oE[iIndex + 1].readOnly == true || oE[iIndex + 1].style.display == "none") {
        /*
        window.status += "e.name = "+oE[iIndex+1].name
        window.status += ";e.type = "+oE[iIndex+1].type
        window.status += ";e.disabled = "+oE[iIndex+1].disabled
        window.status += ";e.readOnly = "+oE[iIndex+1].readOnly+"."
        */
        iIndex++;
        if (iIndex + 1 == oE.length) {
            if (isCycle) {//设置焦点在第一元素
                focusOnNextElement(oE, -1)
            }
            return;
        }
    } //end while
    iCurrent = iIndex + 1
    try
  { oE[iCurrent].focus(); oE[iCurrent].select(); }
    catch (e)
  { }
    return;
}
//处理当前元素
function handleSubmit(element) {
    element.click()
    return;
}
//判断是否处理提交
function isHandleSubmit(element) {
    var ret = false;
    if (element != null && (element.id.toUpperCase() == "SUBMIT" || element.name.toUpperCase() == "SUBMIT" || element.type.toUpperCase() == "SUBMIT")) {
        ret = true;
    }


    return ret;
}
var IsInitialFocus = null;
//初始化 initEnter2Tab()
function initEnter2Tab() {
    var i;

    for (i = 0; i < document.forms.length; i++) {
        if (document.forms[i].getAttribute("type") == null || document.forms[i].getAttribute("type") != "enter2tab") {
            if (navigator.userAgent.indexOf("Opera") == -1) {
                SetEvent(document.forms[i], "keydown", enterToTab);
            }
            else {
                SetEvent(document.forms[i], "keypress", enterToTab); //opera
            }
        }
    }

    //文档初始化焦点
    if (document.forms[0].elements != null && IsInitialFocus == null)
        focusOnNextElement(document.forms[0].elements, -1)
}
/*enter 转化成tab end*/

/*股票代码下拉菜单*/
function SearchStockShow(e, txtObj)//显示搜索结果
{
    //        var obj=GetEventElement(e);
    //        var targetObj=get$("ctl00_ContentPlaceHolder1_"+txtObj);//赋值对象
    //        var keyCode=GetKeyCode(e);
    //        var result="";
    //        if(obj.value.length>=5)
    //        {result=Mang24k99.Web.Class1.ff(obj.value).value;
    //        targetObj.value=result;}
    //需求改变,接口不变,改的时候好改
    var obj = GetEventElement(e);
    var keyCode = GetKeyCode(e);
    var objTable = get$("searchTable");
    var mask = get$("divSearchResult");
    if (objTable != null && objTable.rows.length > 0) {
        if (keyCode == 38)//shang
        {
            if (!!mask)
                mask.style.display = "";
            if (objTable.title == "")
            { objTable.title = objTable.rows.length - 1; objTable.rows[parseInt(objTable.title, 10)].cells[0].className = "tb_title2"; }
            else {
                objTable.title = parseInt(objTable.title, 10) - 1;
                if (parseInt(objTable.title, 10) < 0) {
                    objTable.title = parseInt(objTable.title, 10) + 1;
                }
                var row1 = objTable.rows[parseInt(objTable.title, 10) + 1];
                if (row1 != null) {
                    row1.cells[0].className = "tb_txt2";
                }

                objTable.rows[parseInt(objTable.title, 10)].cells[0].className = "tb_title2";
            }
            if (e.preventDefault) e.preventDefault();
            else { e.returnValue = false };
            if (e.stopPropagation) e.stopPropagation();
            else e.cancelBubble = true;
        }
        else if (keyCode == 40)//xia
        {
            if (!!mask)
                mask.style.display = "";
            if (objTable.title == "")
            { objTable.title = "0"; objTable.rows[parseInt(objTable.title, 10)].cells[0].className = "tb_title2"; }
            else {
                objTable.title = parseInt(objTable.title, 10) + 1;
                if (parseInt(objTable.title, 10) > objTable.rows.length - 1) {
                    objTable.title = parseInt(objTable.title, 10) - 1;
                }
                var row1 = objTable.rows[parseInt(objTable.title, 10) - 1];
                if (row1 != null) {
                    row1.cells[0].className = "tb_txt2";
                }

                objTable.rows[parseInt(objTable.title, 10)].cells[0].className = "tb_title2";
            }
            if (e.preventDefault) e.preventDefault();
            else { e.returnValue = false };
            if (e.stopPropagation) e.stopPropagation();
            else e.cancelBubble = true;
        }

    }
    if (obj.value.length > 0 && !(keyCode == 13 || keyCode == 46 || (keyCode >= 16 && keyCode <= 18) || (keyCode >= 33 && keyCode <= 40))) {
        var iWidth = "width:" + obj.offsetWidth + "px;" //窗口宽度
        var iHeight = "height:" + 100 + "px;"//窗口高度
        //        var iTop=(window.screen.height-iHeight)/2;
        //        var iLeft=(window.screen.width-iWidth)/2;
        // var iWidth="";//窗口宽度
        // var iHeight="";//窗口高度
        var iTop = GetTop(obj) + obj.clientHeight;
        var iLeft = GetLeft(obj);
        var mask = getElementInBody("divSearchResult", "", "", "", "", "position:absolute;left:" + iLeft + "px;top:" + iTop + "px;" + iWidth + iHeight + "z-index:3000; background-color:White;");
        mask.style.display = "";
        mask.style.top = iTop + "px";
        mask.style.left = iLeft + "px";
        mask.style.width = obj.offsetWidth;
        mask.style.height = obj.offsetHeight;
        //            mask.innerHTML=Mang24k99.Web.Class1.GetSearchStockResult(obj.value.trim(),txtObj,obj.id).value;
        if (obj.id == "ctl00_ContentPlaceHolder1_txtSpell" || obj.id == "txtSpell") {
            mask.innerHTML = Mang24k99.Business.CLMN.BKtClmnNewstrastar.GetSpellChines(obj.value.trim(), txtObj, obj.id).value;
        }
        else {
            mask.innerHTML = Mang24k99.Web.KEYW.KtKeyWords.GetSearchStockResult(obj.value.trim(), txtObj, obj.id).value;
        }

        if (mask.innerHTML == "") {
            mask.style.display = "none";
        }
        try { hideToolBar(); }
        catch (e) { }
    }
    else if (obj.value.length <= 0 || !(keyCode == 13 || keyCode == 46 || (keyCode >= 16 && keyCode <= 18) || (keyCode >= 33 && keyCode <= 40))) {
        SearchStockHide();
    }


}
function SearchStockSelected(e, txtObj)//enter 选中搜索结果
{
    //        var obj=GetEventElement(e);
    //        var targetObj=get$("ctl00_ContentPlaceHolder1_"+txtObj);//赋值对象
    //        var keyCode=GetKeyCode(e);
    //        var result="";
    //        var pre="";
    //        
    //        if(keyCode==13)
    //        {
    //            for(i=0;i<5-obj.value.length;i++)
    //            {
    //            pre+="0";
    //            }
    //        obj.value=pre+obj.value;//更新
    //            result=StockList.GetSearchStockResult1(obj.value).value;
    //            targetObj.value=result;
    //            if(e.preventDefault) e.preventDefault();
    //            else{e.returnValue=false};      
    //        }

    //需求改变,接口不变
    ///*
    var obj = GetEventElement(e);
    var keyCode = GetKeyCode(e);
    var objTable = get$("searchTable");
    var objDiv = get$("divSearchResult");

    if (keyCode == 13)//enter
    {
        if (objTable != null && objDiv.style.display == "")
        //if(objTable!=null)
        {
            var value = "";
            if (objTable.title == "")
            { objTable.title = "0"; }

            var rows = objTable.rows[parseInt(objTable.title, 10)];
            if (rows != null) {

                value = objTable.rows[parseInt(objTable.title, 10)].cells[0].innerHTML;
                valueSource = objTable.rows[parseInt(objTable.title, 10)].cells[0].title;

                SearchStockHide(txtObj, value, obj.id, valueSource);
            }
        }

        if (e.preventDefault) e.preventDefault();
        else { e.returnValue = false };
    }
    else if (keyCode == 38 || keyCode == 40) {
        if (e.preventDefault) e.preventDefault();
        else { e.returnValue = false };
    }
    // */
}
//txtobj:名称id,value要传的名称值,txtObjSource:代码的id,valueSource代码的值
function SearchStockHide(txtObj, value, txtObjSource, valueSource)//隐藏搜索结果
{
    var mask = get$("divSearchResult");
    if (!!mask)
        mask.style.display = "none";
    if (txtObj != null) {
        if (txtObjSource == "ctl00_ContentPlaceHolder1_txtSpell" || txtObjSource == "txtSpell") {
            var objtxt = get$(txtObjSource);
            objtxt.value = "";
            
            var obj = get$("ctl00_ContentPlaceHolder1_" + txtObj);
            if (obj == null)
            { obj = get$(txtObj); }
            
            var elementOp = document.createElement("OPTION");
            elementOp.text = value;
            elementOp.value = valueSource;
            if (value == "0")
            { return; }
            if (IsSelectContains(obj, valueSource)) {

                return;
            }
            obj.options.add(elementOp)
            obj.doScroll("down");
            obj.doScroll("down");
            obj.doScroll("down");
            obj.doScroll("down");
            SetStartValue(obj);

        }
        else {
            var obj = get$("ctl00_ContentPlaceHolder1_" + txtObj);
            if (obj == null) {
                return;
            }
            obj.value = value;
            obj.style.backgroundColor = "#FFFFCC";
            var objH = get$("ctl00_ContentPlaceHolder1_" + txtObj + "H");
            if (objH == null)
            { return; }
            objH.value = valueSource;
        }

    }
    //        if(txtObjSource!=null)
    //        {get$(txtObjSource).value=valueSource;}

}
function RemoveDblClickOption(tagID) {
    var index = tagID.selectedIndex;
    if (index == -1) return;
    tagID.remove(index);
    SetStartValue(tagID);
}
function SetStartValue(obj) {
    var i;
    var str = "";
    for (i = 0; i < obj.length; i++) {
        str = str + obj[i].value + ",";
    }
    var objStart = get$("ctl00_ContentPlaceHolder1_txtStartValue");
    if (objStart == null) {
        objStart = get$("txtStartValue");
    }
    
    objStart.value = str;
}
function IsSelectContains(obj, value) {
    var i;

    for (i = 0; i < obj.length; i++) {
        var tempOp = obj[i];
        if (value == tempOp.value) {
            tempOp.style.color = "red";
            return true;
        }
    }
    return false;
}
/*股票代码下拉菜单 end*/
//设置select控件的选中项
function SetSelect(name, value) {
    var sel = get$(name);
    for (i = 0; i < sel.options.length; i++) {
        if (sel.options[i].value == value) {
            //sel.options[i].selected=true;
            return;
        }
    }
}
   